package com.wanmait.test.util;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;

public class CookieUtil {
	public static String getCookie(String name,HttpServletRequest request)
	{
		String value=null;
		Cookie[] cookies = request.getCookies();
		
		if(cookies!=null) {
			for (Cookie cookie : cookies) {
				if(cookie.getName().equals(name))
				{
					value = cookie.getValue();
					break;
				}
			}
		}
		return value;
	}
}
